package system

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/net/ghttp"
	"server/api"
	"server/internal/model"
)

type FileUploadReq struct {
	g.Meta      `path:"/system/file/upload" tags:"系统管理-文件" method:"post" mime:"multipart/form-data" summary:"单文件上传" dc:"单文件上传"`
	CategoryId  int64             `dc:"文件上传的目录分类ID"`
	FileSubject string            `v:"required" dc:"文件主题，用于区分存储文件目录"`
	StorageType int               `v:"required|in:1,2,3" dc:"文件存储类型：1-本地；2-阿里云；3-腾讯云"`
	File        *ghttp.UploadFile `v:"required" json:"file" type:"file" dc:"选择文件上传"`
}
type FileUploadRes struct {
	Detail model.FileUploadOutput `json:"detail"`
}

type FileDeleteReq struct {
	g.Meta `path:"/system/file/delete" tags:"系统管理-文件" method:"post" summary:"单文件删除" dc:"单文件删除"`
	Path   string `v:"required" dc:"文件路径或文件key"`
}
type FileDeleteRes struct {
	Result int `json:"result"`
}

type FileListReq struct {
	g.Meta          `path:"/system/file/list" tags:"文件模块" method:"GET" sm:"文件列表" dc:"文件列表"`
	FileCategoryIds []int  `json:"file_category_ids" dc:"附件分类ID"`
	OriginalName    string `json:"original_name" dc:"原始文件名"`
	api.PagerReq
}
type FileListRes struct {
	api.PagerRes
}

type FileCategoryCreateReq struct {
	g.Meta   `path:"/file/category/create" mime:"multipart/form-data" tags:"文件模块" method:"POST" sm:"添加文件分类" dc:"添加文件分类"`
	ParentId int    `v:"required" dc:"父级ID"`
	Name     string `v:"required" json:"name" dc:"分类名称"`
}
type FileCategoryCreateRes struct {
	Id int64 `json:"id" dc:"ID"`
}

type FileCategoryDeleteReq struct {
	g.Meta `path:"/file/category/delete" mime:"multipart/form-data" tags:"文件模块" method:"POST" sm:"删除文件分类" dc:"删除文件分类"`
	Id     int `v:"required" dc:"分类ID"`
}
type FileCategoryDeleteRes struct {
	RowsAffected int64 `json:"rows_affected" dc:"影响行数"`
}

type FileCategoryUpdateReq struct {
	g.Meta   `path:"/file/category/update" mime:"multipart/form-data" tags:"文件模块" method:"POST" sm:"添加文件分类" dc:"添加文件分类"`
	Id       int    `v:"required" dc:"分类ID"`
	ParentId int    `v:"required" dc:"父级ID"`
	Name     string `v:"required" json:"name" dc:"分类名称"`
}
type FileCategoryUpdateRes struct {
	RowsAffected int64 `json:"rows_affected" dc:"影响行数"`
}

type FileCategoryTreeReq struct {
	g.Meta `path:"/file/category/tree" mime:"multipart/form-data" tags:"文件模块" method:"GET" sm:"获取文件分类树形结构数据" dc:"获取文件分类树形结构数据"`
}
type FileCategoryTreeRes struct {
	Data interface{} `json:"data" dc:""`
}
